<template>
  <div>
    <el-card>
      <!-- 头部 -->
      <template v-slot:header>
        <div class="header">
          <span>线上热门搜索</span>
          <!-- 下拉菜单 -->
          <el-dropdown>
            <span class="el-dropdown-link">
              <i class="el-icon-more"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>黄金糕</el-dropdown-item>
              <el-dropdown-item>狮子头</el-dropdown-item>
              <el-dropdown-item>螺蛳粉</el-dropdown-item>
              <el-dropdown-item disabled>双皮奶</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </template>

      <!-- 内容部分 -->
      <div class="body">
        <!-- charts图表 -->
        <el-row :gutter="30">
          <el-col :span="12">
            <lineCharts title="搜索用户数" num="666" percent="12.6%" flag="up" :lineData="[11,23,46,77,66,34,45]"></lineCharts>
          </el-col>
          <el-col :span="12">
            <lineCharts title="人均搜索次数" num="46" percent="2.3%" flag="down" :lineData="[71,66,60,55,28,33,38]"></lineCharts>
          </el-col>
        </el-row>

        <!-- 表格 -->
        <el-table
          border
          :data="[]"
          style="width: 100%;margin-top:20px"
          :default-sort="{prop: 'date', order: 'descending'}"
        >
          <el-table-column type="index" label="排名" width="80"></el-table-column>
          <el-table-column prop="word" label="搜索关键字"></el-table-column>
          <el-table-column prop="user" label="用户数" sortable></el-table-column>
          <el-table-column prop="address" sortable label="周涨幅"></el-table-column>
        </el-table>

        <!-- 分页器 -->
        <el-pagination layout="prev, pager, next" style="margin-top:20px;text-align:center" :total="100"></el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
// 导入折线图
import lineCharts from './lineCharts'
import { mapState } from 'vuex'

export default {
  name: 'Search',
  data () {
    return {
      list: []
    }
  },
  components: {
    lineCharts
  },
  computed: {
    ...mapState({
      stateList: state => state.home.list
    })
  }
}
</script>

<style scoped>
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.el-dropdown-link {
  cursor: pointer;
  /* color: #409eff; */
}

.el-icon-more {
  font-size: 20px;
}

.charts-header {
  display: flex;
  justify-content: space-between;
}

.el-icon-caret-top {
  color: red;
}

.content {
  margin: 20px 0;
}

.content-main {
  font-size: 30px;
  margin-right: 30px;
}

.content-percent {
  color: grey;
  font-size: 16px;
}
</style>
